package com.jintoufs.util.weixin;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jintoufs.util.http.HttpUtils;

/**
 * crateTime:2017/5/24 16:20
 * author:administrator
 * description:请写注释
 */
public class AccessTokenUtil {
    public static String getAccessToken(String appId, String secret) {
        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appId=" + appId + "&secret=" + secret;
        String json = HttpUtils.getURLContent(url);
        if (!json.isEmpty()) {
            JSONObject jsonObject = JSON.parseObject(json);
            return jsonObject.getString("access_token");
        }
        return "";
    }
}
